<?php


namespace app\admin\model;


use app\common\impl\Comm;
use app\common\model\AdminBaseModel;
use think\Exception;

class AdminUserModel extends AdminBaseModel implements Comm
{
    protected $name = "admin_user";

    //隐藏字段
    protected $hidden=["password"];

    public function getAdminPageData($param = [], $order = 'id asc')
    {
        // TODO: Implement getAdminPageData() method.
        $where=[];
        if (isset($param['username']) && $param['username'] != '') {
            $where[] = ['username', 'like', "%" . $param['username'] . "%"];
        }
        try {
            $data = self::where($where)->order($order)->page(PAGE)->limit(LIMIT)->select()->toArray();
            $count = self::where($where)->count("id");

            return parent::ajaxResult($data, $count);
        } catch (Exception $exception) {
            return parent::ajaxResult([], 0, 100, $exception->getMessage());
        }
    }

    public function delById($id)
    {
        // TODO: Implement delById() method.
        return parent::del($id);
    }


    public function doAll($data)
    {
        // TODO: Implement doAll() method.
        return parent::doAllData($data);
    }

}